<?php

namespace app\models;

use yii\base\Model;
use yii\web\UploadedFile;

class Upload extends Model
{
    /**
     * @var UploadedFile[]
     */
    public $file;


    public function upload($name)
    {
        $yy=$this->validate();
        $re='yyy';
        if ($this->validate()) {
            $this->file->saveAs('img/' . $name . '.' . $this->file->extension);
            $fname=$name.'.'.$this->file->extension;
            return $fname;
        }
        else
        {
            return false;
        }
    }
}